package com.example.bilibili_miaosha.rabbitmq;

/**
 * @ClassName MQSender
 * @Description TODO
 * @Author 川
 * @Date 2022/5/13 15:19
 * @Version 1.0
 **/

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class MQSender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(Object msg) {
        log.info("发送消息：" + msg);
        rabbitTemplate.convertAndSend("queue", msg);
    }
}
